package com.qf.sl.youshare.model;

import android.text.Html;
import android.text.Spanned;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by IDEA
 * User : SL
 * on  2015/2/20.
 * 20:24
 */
public class Article {

    private String articleId;
    private String userId;
    private String cateId;
    private String title;
    private String content;
    private String path;
    private String photo;
    private String isRecommend;
    private String countComment;
    private String countRecommend;
    private String countView;
    private String addTime;
    private boolean userInfo;

    public void parseJSON(JSONObject jsonObject){
        try {

            articleId = jsonObject.getString("articleid");
            userId = jsonObject.getString("userid");
            cateId = jsonObject.getString("cateid");
            String string = jsonObject.getString("title");

            Spanned html = Html.fromHtml(string);
            title = html.toString();

            content = jsonObject.getString("content");
            path = jsonObject.getString("path");
            photo = jsonObject.getString("photo");
            isRecommend = jsonObject.getString("isrecommend");
            countComment = jsonObject.getString("count_comment");
            countRecommend = jsonObject.getString("count_recommend");
            countView = jsonObject.getString("count_view");
            addTime = jsonObject.getString("addtime");
            userInfo = jsonObject.getBoolean("userinfo");

        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public String getArticleId() {
        return articleId;
    }

    public String getUserId() {
        return userId;
    }

    public String getCateId() {
        return cateId;
    }

    public String getTitle() {
        return title;
    }

    public String getContent() {
        return content;
    }

    public String getPath() {
        return path;
    }

    public String getPhoto() {
        return photo;
    }

    public String getIsRecommend() {
        return isRecommend;
    }

    public String getCountComment() {
        return countComment;
    }

    public String getCountRecommend() {
        return countRecommend;
    }

    public String getCountView() {
        return countView;
    }

    public String getAddTime() {
        return addTime;
    }

    public boolean isUserInfo() {
        return userInfo;
    }
}
